{include file="public_head" /}
<!-- upload -->
<link href="__STATIC__/css/uploads.css" rel="stylesheet">
<!-- Select2 -->
<link href="__STATIC__/css/select/select2.min.css" rel="stylesheet">
<body class="nav-md">

<div class="container body">


    <div class="main_container">

        {include file="public_sidebar,public_nav" /}

        <!-- page content -->
        <div class="right_col" role="main">

            <div class="x_panel">
                <div class="x_title">
                    <h2><i class="fa fa-bars"></i> 配置管理 </h2>
                    <ul class="nav navbar-right panel_toolbox">
                        <li class="dropdown">
                            <a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                        </li>
                        <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                        </li>
                        <li><a class="close-link"><i class="fa fa-close"></i></a>
                        </li>
                    </ul>
                    <div class="clearfix"></div>
                </div>
                <div class="x_content">

                    <div class="" role="tabpanel" data-example-id="togglable-tabs">
                        <ul id="myTab" class="nav nav-tabs bar_tabs" role="tablist">
                            {volist name='data' id='list'}
                            <li role="presentation" class="{empty name='$key'}active{/empty}">
                                <a href="#tab_content{$key}" id="tab{$key}" role="tab" data-toggle="tab"
                                   aria-expanded="{empty name='$key'}true{else /}false{/empty}"> {$list.title} </a>
                            </li>
                            {/volist}
                            <!--<li role="presentation" class="">-->
                                <!--<a href="#tab_content888" id="tab888" role="tab" data-toggle="tab"-->
                                   <!--aria-expanded="false"> 图片设置 </a>-->
                            <!--</li>-->
                            <li role="presentation" class="">
                                <a href="#tab_content999" id="tab999" role="tab" data-toggle="tab"
                                   aria-expanded="false"> 添加新变量 </a>
                            </li>

                        </ul>
                        <div id="myTabContent" class="tab-content">
                            {volist name='data' id='list'}

                            <div role="tabpanel" class="tab-pane fade {empty name='$key'}active in{/empty}"
                                 id="tab_content{$key}" aria-labelledby="tab{$key}">
                                <form name="form" method="post" action="">
                                    {volist name='list["config"]' id='config'}
                                    <div class="form-group has-success " style="margin: 1% 1%;font-size: 16px;">
                                        <div style="float: left;margin: 5px 0;clear: both">{$config.varinfo}：</div>
                                        <div style="clear: both"></div>
                                        {switch name="config.vartype"}

                                        {case value="string"}
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <input class="form-control" type="text" name="{$config.varname}"
                                                   value="{$config.varvalue}">
                                        </div>
                                        {/case}

                                        {case value="number"}
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <input class="form-control" type="number" name="{$config.varname}"
                                                   value="{$config.varvalue}">
                                        </div>
                                        {/case}

                                        {case value="bool"}
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <label class="radio_box">
                                                <input type="radio" class="flat" name="{$config.varname}"
                                                       id="{$config.varname}_1" value="Y" {if
                                                       condition="$config['varvalue'] eq 'Y'" } checked {/if} />&nbsp;
                                                <label for="{$config.varname}_1"></label>
                                                <span>是</span>
                                            </label>
                                            &nbsp;&nbsp;
                                            <label class="radio_box">
                                                <input type="radio" class="flat" name="{$config.varname}"
                                                       id="{$config.varname}_2" value="N" {if
                                                       condition="$config['varvalue'] eq 'N'" } checked {/if} />&nbsp;
                                                <label for="{$config.varname}_2"></label>
                                                <span>否</span>
                                            </label>
                                        </div>
                                        {/case}

                                        {case value="bstring"}
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                                <textarea class="form-control" style="height: 120px;"
                                                          name="{$config.varname}">{$config.varvalue}</textarea>
                                        </div>
                                        {/case}

                                        {default /}参数错误

                                        {/switch}
                                        <div style="margin-top: 5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${$config.varname}</div>
                                        <!--<input type="hidden" name="id" value="{$config.id}">-->
                                    </div>
                                    {/volist}
                                    <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3" style="margin-top: 20px;">
                                        <button type="submit" class="btn btn-success">提交</button>
                                        <button type="button" class="btn btn-primary" onclick="history.go(-1)">返回</button>
                                    </div>
                                </form>
                            </div>

                            {/volist}

                    <div role="tabpanel" class="tab-pane fade" id="tab_content999" aria-labelledby="tab999">
                        <form name="form" method="post" action="{:url('config/addVariables')}" enctype="multipart/form-data">

                            <div class="form-group" style="margin: 1% 1%;font-size: 16px;">
                                <div style="float: left;margin: 5px 0;clear: both">所属配置组：</div>
                                <div style="clear: both"></div>
                                <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                    <select name="vargroup" id="vargroup" class="select2_single" style="width: 500px;" tabindex="-1">
                                        <option></option>
                                        {volist name='data' id='list'}
                                        <option value="{$list.id}">{$list.title}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>

                            <div class="form-group" style="margin: 1% 1%;font-size: 16px;">
                                <div style="float: left;margin: 5px 0;clear: both">变量名称：</div>
                                <div style="clear: both"></div>
                                <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                    <input class="form-control" type="text" name="varname" placeholder="系统会自动为变量添加 '$web_' 前缀">
                                </div>
                            </div>

                            <div class="form-group" style="margin: 1% 1%;font-size: 16px;">
                                <div style="float: left;margin: 5px 0;clear: both">参数说明：</div>
                                <div style="clear: both"></div>
                                <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                    <input class="form-control" type="text" name="varinfo" placeholder="变量的描述信息">
                                </div>
                            </div>

                            <div class="form-group" style="margin: 1% 1%;font-size: 16px;">
                                <div style="float: left;margin: 5px 0;clear: both">变量值：</div>
                                <div style="clear: both"></div>
                                <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                    <input class="form-control" type="text" name="varvalue" placeholder="请填写变量值">
                                </div>
                            </div>

                            <div class="form-group" style="margin: 1% 1%;font-size: 16px;">
                                <div style="float: left;margin: 5px 0;clear: both">变量类型</div>
                                <div style="clear: both"></div>
                                <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                    <label class="radio_box">
                                        <input type="radio" id="vartype_1" name="vartype" value="string" checked />&nbsp;
                                        <label for="vartype_1"></label>
                                        <span>文本</span>
                                        &nbsp;&nbsp;
                                    </label>
                                    <label class="radio_box">
                                        <input type="radio" id="vartype_2" name="vartype" value="number" />&nbsp;
                                        <label for="vartype_2"></label>
                                        <span>数字</span>
                                        &nbsp;&nbsp;
                                    </label>
                                    <label class="radio_box">
                                        <input type="radio" id="vartype_3" name="vartype" value="bool" />&nbsp;
                                        <label for="vartype_3"></label>
                                        <span>布尔(Y/N)</span>
                                        &nbsp;&nbsp;
                                    </label>
                                    <label class="radio_box">
                                        <input type="radio" id="vartype_4" name="vartype" value="bstring" />&nbsp;
                                        <label for="vartype_4"></label>
                                        <span>多行文本</span>
                                        &nbsp;&nbsp;
                                    </label>
                                </div>
                            </div>
                            <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3"
                                 style="margin-top: 20px;">
                                <button type="submit" class="btn btn-success">提交</button>
                                <button type="button" class="btn btn-primary" onclick="history.go(-1)">返回</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

</div>
<!-- /page content -->
</div>

</div>

{include file="public_foot" /}
<!--upload-->
<script type="text/javascript" src="__STATIC__/js/uploadPreview.js"></script>
<!--color-->
<script type="text/javascript" src="__STATIC__/js/jscolor.js"></script>
<!--select-->
<script src="__STATIC__/js/select/select2.full.min.js"></script>
<script>
    //upload
    window.onload = function () {
        new uploadPreview({UpBtn: "up_img", DivShow: "imgdiv", ImgShow: "imgShow", ImgType: ["png","jpg"], ErrMsg: "选择文件错误,图片类型必须是png文件!"});
        new uploadPreview({UpBtn: "up_img_1", DivShow: "imgdiv_1", ImgShow: "imgShow_1", ImgType: ["png","jpg"], ErrMsg: "选择文件错误,图片类型必须是png文件!"});
        new uploadPreview({UpBtn: "up_img_2", DivShow: "imgdiv_2", ImgShow: "imgShow_2", ImgType: ["png","jpg"], ErrMsg: "选择文件错误,图片类型必须是png文件!"});
        new uploadPreview({UpBtn: "up_img_3", DivShow: "imgdiv_3", ImgShow: "imgShow_3", ImgType: ["png","jpg"], ErrMsg: "选择文件错误,图片类型必须是png文件!"});
    };
    // select2
    $(document).ready(function() {
        $(".select2_single").select2({
            placeholder: "请选择分类",
            allowClear: true
        });
    });
</script>
</body>

</html>
